import request from '../request.js'

export const getAllGroupApi = () => {
  return request.get('task/menu/query/all')
}

export const getAllTaskByGroupIdApi = (groupId, pageParam) => {
  return request.get(
    `task/self/query/group?groupId=${ groupId }&pageNum=${ pageParam.pageNum }&pageSize=${ pageParam.pageSize }`
  )
}

export const getTaskByGroupIdAndNameApi = (groupId, name, pageParam) => {
  return request.get(
    `task/self/query/group?groupId=${ groupId }&name=${ name }&pageNum=${ pageParam.pageNum }&pageSize=${ pageParam.pageSize }`
  )
}

export const postTaskApi = data => {
  return request.post('task/self/add/newTask', data)
}

export const deleteTaskByIdApi = data => {
  return request.post('task/self/delete/taskId', data)
}

export const putTaskApi = data => {
  return request.post('task/self/update/taskId', data)
}

export const deleteParticipantByIdApi = data => {
  return request.post('task/participant/delete/participant', data)
}

export const getUserInfoByNameApi = name => {
  return request.get(`task/participant/query/user/all?name=${ name }`)
}

export const postParticipantApi = (data) => {
  return request.post('task/participant/add/participant', data)
}

//获取各组完结率

export const getStatisticValue = () => {
  return request.get('task/statistic/get/statisValue')
}

export const findProjectDetailsByProjectIdApi = (params) => {
  return request.get('project/self/detail', {params})
}

export const findAllProjectByGroupIdApi = (params) => {
  return request.get('project/self/get/groupProject', {params})
}

export const findMemberTaskParticipationApi = (params) => {
  return request.get('project/self/get/taskParticipation', {params})
}

export const findAllProjectTaskApi = (params) => {
  return request.get('project/self/get/tasks', {params})
}